package 作业;

public class BinaryTreeTest {
    public static void main(String[] args) {

        /*
         *          10
         *     5          15
         *  2     8   13      17
         *                14     18
        /*
                    13
               5           15
            2    8            17
         */
        BinaryTree<Integer> binaryTree = new BinaryTree<>(10);
        System.out.println(binaryTree.insertElement(5));
        System.out.println(binaryTree.insertElement(15));
        System.out.println(binaryTree.insertElement(2));
        System.out.println(binaryTree.insertElement(8));
        System.out.println(binaryTree.insertElement(13));
        System.out.println(binaryTree.insertElement(14));
        System.out.println(binaryTree.insertElement(17));
        System.out.println(binaryTree.insertElement(18));
        System.out.println("--------------------------");

        binaryTree.preOrderTraversal();
        System.out.println();
        binaryTree.inOrderTraversal();
        System.out.println();
        binaryTree.postOrderTraversal();
        System.out.println();
        binaryTree.levelOrderTraversal();
        System.out.println();
        System.out.println(binaryTree.findElementAndDelete(15));
        System.out.println();
        System.out.println("--------------------------");
        binaryTree.preOrderTraversal();
        System.out.println();
        binaryTree.inOrderTraversal();
        System.out.println();
        binaryTree.postOrderTraversal();
        System.out.println();
        binaryTree.levelOrderTraversal();
        System.out.println();
        System.out.println("______________________________________________________________________");
        binaryTree.precursorSubsequent(17, BinaryTree.BinaryTreePSRL.BINARY_TREE_PRECURSOR);
        System.out.println("______________________________________________________________________");
        binaryTree.precursorSubsequent(17, BinaryTree.BinaryTreePSRL.BINARY_TREE_SUBSEQUENT);
        System.out.println("______________________________________________________________________");
        binaryTree.precursorSubsequent(17, BinaryTree.BinaryTreePSRL.BINARY_TREE_PS);
    }
}
